/**
* Copyright (c) 2007,中企动力华南研发中心
* All rights reserved.
*/

package com.ce.pms.custservice.dao;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.util.List;

import org.junit.Test;

import com.ce.pms.DBUnitTool;
import com.ce.pms.custservice.vo.ReturnVisitRecordVO;
import com.sitechasia.webx.core.support.Page;

/**
 * @author 高嵩 编写日期:2008-12-18
 *	回访登记测试类
 */
public class ReturnVisitRecordDaoImplT extends DBUnitTool{

	private IReturnVisitRecordDao returnVisitRecordDao =  null;
	/* (non-Javadoc)
	 * @see com.ce.pms.DBUnitTool#setUp()
	 */
	@Override
	public void setUp() throws Exception {
		// TODO Auto-generated method stub
		super.setUp();
		initCustServiceEventDao();
	}

	private void initCustServiceEventDao(){
		if (this.returnVisitRecordDao==null) {
			this.returnVisitRecordDao = (IReturnVisitRecordDao)this.applicationContext.getBean("returnVisitRecordDao");
		}
		assertNotNull(returnVisitRecordDao);
	}

	/* (non-Javadoc)
	 * @see com.ce.pms.DBUnitTool#tearDown()
	 */
	@Override
	public void tearDown() throws Exception {
		// TODO Auto-generated method stub
		super.tearDown();
		returnVisitRecordDao =  null;
	}



    /***
     * 功能描述:  测试分页查询回访登记<br>
     * @param returnVisitRecordVO
     * @return Page
	 * @roseuid 49435189006D
     * Create author:高嵩 <br>
     * Create on:2008-12-23  <br>
     * Edit author:  <br>
     * Edit on:    <br>
     * Why:     <br>
     */
	@Test
   public void testQueryReturnVisitRecordByPage(){
		System.out.println("按页查询客服事件开始------------------");
		ReturnVisitRecordVO returnVisitRecordVO = new ReturnVisitRecordVO();

		returnVisitRecordVO.setPageNo(new Integer(1));
		returnVisitRecordVO.setPageSize(new Integer(4));
		assertNotNull(returnVisitRecordDao);

		Page page= returnVisitRecordDao.queryReturnVisitRecordByPage(returnVisitRecordVO);
		assertNotNull(page);
		List datas = page.getResult();
		assertEquals(datas.size(),4);
		assertEquals(page.getResult().size(), 4);
		assertEquals(page.getCurrentPageNo(), 1);
		assertEquals(page.getTotalCount(), 15);
		assertEquals(page.getTotalPageCount(), 4);
   }
}
